﻿using DataAchive.Model.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;

namespace DataAchive.xamls
{
    internal class NgDocRender : IDocRender
    {
        public void Render(FlowDocument doc, object data)
        {
            
            TableRowGroup group =doc.FindName("ngRowGroup") as TableRowGroup;
            Style styleTable = doc.Resources["BorderTable"] as Style;
            Style styleCell = doc.Resources["TableCell"] as Style;
            foreach (var item in (List<NgData>)data)
            {
                TableRow row = new TableRow();
                

                TableCell cell1 = new TableCell(new Paragraph(new Run(item.Lot_Id)));
                cell1.Style =styleCell;
                row.Cells.Add(cell1);
                TableCell cell2 = new TableCell(new Paragraph(new Run(item.Equipment_Id)));
                row.Cells.Add(cell2);
                TableCell cell3 = new TableCell(new Paragraph(new Run(item.AI_Result)));
                row.Cells.Add(cell3);
                TableCell cell4 = new TableCell(new Paragraph(new Run(item.Manua_Result)));
                row.Cells.Add(cell4);

                group.Rows.Add(row);

                
            }
        }
    }
}
